﻿using System.Data;
using MvvmFoundation.Wpf;
using System.Collections.ObjectModel;
using WpfApplication1.Wpf;

namespace WpfApplication1.ContactModule
{
    public class ContactsViewModel : CrudViewModel<ContactItem>
    {
        private readonly IContactItemsRepository _context;

        public ContactsViewModel(IContactItemsRepository context) : base(context)
        {
            _context = context;

        }

        protected override void Read()
        {
            Items.Clear();
            foreach (ContactItem contactItem in _context.Contacts)
            {
                Items.Add(contactItem);
            }
        }       

    }
}
